package com.cq.hd.member.api;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.member.api.dto.AppUserPageDto;
import com.cq.hd.member.api.dto.AppUserPwdUpdateDto;
import com.cq.hd.member.api.dto.LoginDto;
import com.cq.hd.member.api.dto.OrderSettleUpdateDto;
import com.cq.hd.member.api.vo.AppUserPageVo;
import com.cq.hd.member.api.vo.AppUserVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;

@FeignClient(value = "hd-o2o-member-service", contextId = "app-user-api")
public interface TbAppUserApi {

    // 列表
    @GetMapping("/member/appUser/pageAppUser")
    Result<Page<AppUserPageVo>> pageAppUser(@SpringQueryMap AppUserPageDto appUserPageDto);

    // 根据手机号获取用户信息
    @GetMapping("/member/appUser/getByMobile")
    Result<AppUserVo> getByMobile(@RequestParam("mobile") String mobile);

    // 用户注册
    @PostMapping("/member/appUser/register")
    Result<AppUserVo> register(@RequestBody LoginDto loginDto);

    // 根据用户id获取用户信息
    @GetMapping("/member/appUser/getById")
    Result<AppUserVo> getById(@RequestParam("id") long id);

    // 根据openId获取用户信息
    @GetMapping("/member/appUser/getByOpenId")
    Result<AppUserVo> getByOpenId(@RequestParam("openId") String openId);

    // 根据用户id获取用户信息
    @PostMapping("/member/appUser/listByUserIds")
    Result<List<AppUserVo>> listByUserIds(@RequestBody List<Long> userIds);

    // 根据日期查询新注册的用户数
    @GetMapping("/member/appUser/getNewCountByDate")
    Result<Integer> getNewCountByDate(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

    // 给经纪人增加佣金账户余额
    @PostMapping("/member/appUser/addCommissionAmt")
    Result<Boolean> addCommissionAmt(@RequestParam("userId") Long userId, @RequestParam("commissionAmt") BigDecimal commissionAmt);

    // 更新商户本金，商户补贴和经纪人佣金，添加商户资金流水和经纪人佣金流水，统计商家与经纪人的累计结算分销佣金
    @PostMapping("/member/appUser/updateOrderSettleAmt")
    Result<Boolean> updateOrderSettleAmt(@RequestBody OrderSettleUpdateDto orderSettleUpdateDto);

    // 根据用户id更新unionid
    @PostMapping("/member/appUser/updateUnionidById")
    Result<Boolean> updateUnionidById(@RequestParam("id") Long id, @RequestParam("unionid") String unionid);

    // 根据unionid获取用户数据
    @PostMapping("/member/appUser/getByUnionid")
    Result<AppUserVo> getByUnionid(@RequestParam("unionid") String unionid);

    // 修改登录密码
    @PostMapping("/member/appUser/updatePwd")
    Result<Boolean> updatePwd(@RequestBody AppUserPwdUpdateDto appUserPwdUpdateDto);
}
